//
//  ZZNextViewController.m
//  Sina
//
//  Created by 张卓 on 2017/1/17.
//  Copyright © 2017年 ZZ. All rights reserved.
//

#import "ZZNextViewController.h"

@interface ZZNextViewController ()

@end

@implementation ZZNextViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [self randomColor];
    [self setupUI];
}

- (void)setupUI {
    
    self.navigationItem.title = [NSString stringWithFormat:@"第%lu个控制器",
                                 self.navigationController.childViewControllers.count];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:[UIButton leftBntWith:nil andTitle:@"PUSH" andTarget:self andAction:@selector(pushController)]];
    
}
- (void)pushController {
    ZZNextViewController *nextVC = [[ZZNextViewController alloc]init];
    [self.navigationController pushViewController:nextVC animated:YES];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (UIColor *)randomColor {
    UIColor *color = [UIColor colorWithRed:
                      arc4random_uniform(256) / 255.f
                                     green:arc4random_uniform(256) / 255.f
                                      blue:arc4random_uniform(256) / 255.f
                                     alpha:1.0f];
    
    return color;
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
